<template>
    <div>
        课程：<input type="text"><br>
        上传图片：<van-uploader :after-read="upload" />
    </div>
</template>

<script>
    export default {
        data(){
            return{
                name:''
            }
        },
        methods:{
            upload(file){
                let data = new FormData()
                data.append('name',this.name)
                data.append('file',file.file)
                this.$axios.post('users/add',data).then(res=>{
                    this.url = this.upload_dir+this.name+'/'+res.data.filename
                })
            }
        }
    }
</script>

<style scoped>

</style>